<?php

namespace app\admin\validate\curriculum;

use app\admin\validate\Validates;

class Teacher extends Validates
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */	
	protected $rule = [
        'ids|标识' => 'require|array',
	    'id|参数' => 'require|>:0',
	    'name|教师名称' => 'length:1,10',
        'head_url|头像' => 'checkReal|checkImage',
        'profiles|简介' => 'max:200'
    ];
    
    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */	
    protected $message = [];

    /**
     * 定义场景
     * @var []
     */
    protected $scene = [
        'index' => ['name'],
        'delete' => ['id'],
        'destory' => ['ids'],
    ];

    /**
     * 定义新增场景验证
     * @return $this
     */
    public function sceneCreate()
    {
        return $this->only(['name','head_url','profiles'])
            ->append('name', 'require');
    }

    /**
     * 定义编辑场景验证
     * @return $this
     */
    public function sceneUpdate()
    {
        return $this->only(['name','head_url','profiles'])
            ->append('name', 'require');
    }

}
